/*
 * @Author: ljk
 * @Date: 2023-05-13 16:25:44
 * @LastEditors: ljk
 * @LastEditTime: 2023-05-14 11:31:06
 * @Description: 共享内存写入端
 */
#include "comm.hpp"

int main()
{
    Init init(CLIENT);
    //start已经指向了共享内存的起始空间
    char* start = init.getStart();

    
    char c = 'A';
    while (c <= 'Z')
    {
        start[c - 'A'] = c;
        c++;
        start[c - 'A'] = 0;
        sleep(1);
    }

    // char* start = init.getStart();
    // key_t k = getKey();
    // cout << "client key: " << toHex(k) << endl;

    // int shmid = getShm(k, gsize);
    // cout << "client shmid: " << shmid << endl;

    // //3. 将自己和共享内存关联起来
    // char* start = attachShm(shmid);

    // // 通信代码
    
    // // 4. 将自己和共享内存去关联
    // detachShm(start);

    // sleep(15);

    return 0;
}